<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="/style/basic_layout.css" rel="stylesheet" type="text/css">
<link href="/style/common_style.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="/js/jquery/jquery.js"></script>
<script type="text/javascript" src="/js/plugins/artDialog/jquery.artDialog.js?skin=blue"></script>
<script type="text/javascript" src="/js/plugins/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="/js/commonAll.js"></script>
<script type="text/javascript">
	$(function () {
		$(".Wdate[name='beginDate']").click(function () {
			WdatePicker({
				readOnly: true,
				maxDate: new Date()
			});
		});
        $(".Wdate[name='endDate']").click(function () {
            WdatePicker({
                readOnly: true,
				minDate: $(".Wdate[name='beginDate']").val(),
                maxDate: new Date()
            });
        });
        //点击审核按钮,发送审核请求
		$(".btn_audit").click(function () {
			var url = $(this).data("url");
			showDialog("确定要审核吗？",function () {
				$.get(url,function () {
					showDialog("审核成功",function () {
						location.reload();
                    });
                },true);
            });
        });
    });
</script>
<title>WMS-演示版</title>
<style>
	.alt td{ background:black !important;}
</style>
</head>
<body>
	<form id="searchForm" action="/stockIncomeBill/list.do" method="post">
		<div id="container">
			<div class="ui_content">
				<div class="ui_text_indent">
					<div id="box_bstockIncome">
						<div id="box_top">搜索</div>
						<div id="box_center">
							业务时间
							<fmt:formatDate var="beginDate" value="${qo.beginDate}" pattern="yyyy-MM-dd"/>
							<fmt:formatDate var="endDate" value="${qo.endDate}" pattern="yyyy-MM-dd"/>
							<input type="text" class="ui_input_txt02 Wdate" name="beginDate" value="${beginDate}"/> ~
							<input type="text" class="ui_input_txt02 Wdate" name="endDate" value="${endDate}"/>
							仓库
							<select class="ui_select01 depot" name="depotId">
								<option value="-1">全部仓库</option>
								<c:forEach items="${depots}" var="s">
									<option value="${s.id}">${s.name}</option>
								</c:forEach>
							</select>
							状态
							<select class="ui_select01 status" name="status">
								<option value="-1">全部</option>
								<option value="1">待审核</option>
								<option value="2">已审核</option>
							</select>
							<script type="text/javascript">
								//回显仓库的下拉数据
								$(".depot option[value='${qo.depotId}']").prop("selected",true);
								$(".status option[value='${qo.status}']").prop("selected",true);

							</script>
						</div>
						<div id="box_bottom">
							<input type="button" value="查询" class="ui_input_btn01 btn_page"/>
							<input type="button" value="新增" class="ui_input_btn01 btn_input"
								data-url="/stockIncomeBill/input.do"/>
						</div>
					</div>
				</div>
			</div>
			<div class="ui_content">
				<div class="ui_tb">
					<table class="table" cellspacing="0" cellpadding="0" width="100%" align="center" bstockIncome="0">
						<tr>
							<th width="30"><input type="checkbox" id="all" /></th>
							<th>入库单号</th>
							<th>业务时间</th>
							<th>仓库</th>
							<th>总数量</th>
							<th>总金额</th>
							<th>录入人</th>
							<th>审核人</th>
							<th>状态</th>
							<th>操作</th>
							<th></th>
						</tr>
						<c:forEach items="${result.data}" var="entity" varStatus="num">
							<tr>
								<td><input type="checkbox" class="acb" data-eid="${entity.id}"/></td>
								<td>${entity.sn}</td>
								<td><fmt:formatDate value="${entity.vdate}" pattern="yyyy-MM-dd"/></td>
								<td>${entity.depot.name}</td>
								<td>${entity.totalNumber}</td>
								<td>${entity.totalAmount}</td>
								<td>${entity.inputUser.name}</td>
								<td>${entity.auditor.name}</td>
								<c:choose>
									<c:when test="${entity.status == 1}">
										<%--待审核显示的按钮--%>
										<td>
											<span style="color: green;">待审核</span>
										</td>
										<td>
											<a href="/stockIncomeBill/input.do?id=${entity.id}">编辑</a>
											<a href="javascript:" class="btn_delete"
											   data-url="/stockIncomeBill/delete.do?id=${entity.id}">删除</a>
											<a href="javascript:" class="btn_audit"
											   data-url="/stockIncomeBill/audit.do?id=${entity.id}">审核</a>
										</td>
									</c:when>
									<c:otherwise>
										<%--已审核显示的按钮--%>
										<td>
										    <span style="color: red;">已审核</span>
										</td>
                                        <td>
											<a href="/stockIncomeBill/billView.do?id=${entity.id}">查看</a>
                                        </td>
									</c:otherwise>
								</c:choose>
							</tr>
						</c:forEach>
					</table>
				</div>
				<%--分页界面--%>
				<%@ include file="/WEB-INF/views/common/page.jsp"%>
			</div>
		</div>
	</form>
</body>
</html>
